#!/usr/bin/env python 
# -*- coding:utf-8 -*-
"""
@Time:2022/3/5 下午2:53"
@Author:lydia_liu"
@File:home_page.py
@function:
"""
from selenium.webdriver.common.by import By

from litemallPrac.page.base_page import BasePage



class HomePage(BasePage):

    _product_manager = (By.XPATH,'//span[contains(text(),"商品管理")]')
    _product_launch = (By.XPATH, '//span[contains(text(),"商品上架")]')
    _product_list = (By.XPATH, '//span[contains(text(),"商品列表")]')
    _product_comment = (By.XPATH,'//span[contains(text(),"商品评论")]')

    def click_meniu(self):
        # 点击菜单中的商品管理---》商品上架
        from litemallPrac.page.product_launch_page import ProductLaunchPage

        self.on_click(*self._product_manager)
        self.on_click(*self._product_launch)


        return ProductLaunchPage(self.driver)

    def click_searchlist(self):
        #点击菜单中的商品管理--》商品列表
        self.on_click(*self._product_manager)
        self.on_click(*self._product_list)

        from litemallPrac.page.product_list_page import ProductListPage

        return ProductListPage(self.driver)

    def click_product_comment(self):
        #点击菜单中的商品管理--》商品评论
        self.on_click(*self._product_manager)
        self.on_click(*self._product_comment)

        from litemallPrac.page.product_comment import ProductComment
        return ProductComment(self.driver)


